package istar.impl;

import istar.IActor;
import istar.ISoftgoal;
import istar.ITask;

public class ContributionLink extends MeansEndLink{

	public static final int BREAK = -2;
	public static final int HURT = -1;
	public static final int UNKNOWN = 0;
	public static final int HELP = 1;
	public static final int MAKE = 2;
	public static final int DOUBLE_NEGATIVE = -2;
	public static final int NEGATIVE = -1;
	public static final int NEUTRAL = 0;
	public static final int POSITIVE = 1;
	public static final int DOUBLE_POSITIVE = 2;
	
	private int value = ContributionLink.NEUTRAL;

	public ContributionLink(String _name, ISoftgoal _end, ISoftgoal _mean){
		super(_name);
		try {
			this.setOwner(_end);
			_end.setMeansEndLink(this);
			//this.setTargetElement(_mean);
			this.getTargetElements().add(_mean);
			_mean.getContributesFor().add(this);
		} catch (Exception e) {
			System.out.println(e.getMessage());
		} 
	}
	
	public ContributionLink(String _name, ISoftgoal _end, ITask _mean){
		super(_name);
		try {
			this.setOwner(_end);
			_end.setMeansEndLink(this);
			//this.setTargetElement(_mean);
			this.getTargetElements().add(_mean);
			_mean.getMeansFor().add(this);
		} catch (Exception e) {
			System.out.println(e.getMessage());
		} 
	}

	public Object clone(IActor newOwner) throws CloneNotSupportedException {
		Object newClone = super.clone(newOwner);
		((ContributionLink)newClone).setValue(this.value);
		return newClone;
	}
	
	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}
	
	
}
